package entity;

import java.util.ArrayList;
import java.util.List;

public class Teacher extends Person {
    private String department;
    private List<Course> taughtCourses = new ArrayList<>();

    public Teacher(String id, String name, String gender, String department) {
        super(id, name, gender);
        this.department = department;
    }

    public void addTaughtCourse(Course course) {
        if (!taughtCourses.contains(course)) {
            taughtCourses.add(course);
        }
    }

    // 教师课表：包含课程名称、时间、地点、学分、学生数
    @Override
    public void printSchedule() {
        System.out.println("\n===== 教师授课表 =====");
        System.out.println("教师ID：" + id);
        System.out.println("姓名：" + name + "（" + gender + "）");
        System.out.println("所属部门：" + department);
        System.out.println("授课总数：" + taughtCourses.size() + "门");
        System.out.println("---------------------");

        if (taughtCourses.isEmpty()) {
            System.out.println("暂无授课记录");
            return;
        }

        for (Course course : taughtCourses) {
            System.out.println("课程名称：" + course.getName());
            System.out.println("课程ID：" + course.getId());
            System.out.println("上课时间：" + course.getTime());
            System.out.println("上课地点：" + course.getLocation());
            System.out.println("学分：" + course.getCredit());
            System.out.println("选课学生数：" + course.getStudents().size() + "人");
            System.out.println("---------------------");
        }
    }

    public String getDepartment() { return department; }
    public List<Course> getTaughtCourses() { return taughtCourses; }
}